package org.example.ymcc.task;

import org.example.ymcc.service.IKillCourseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class PublishKillCourseTask {
    @Autowired
    private IKillCourseService killCourseService;

    //每天凌晨1点执行一次：0 0 23 * * ?
    //每天晚上，12点，发布秒杀课程到Redis
    @Scheduled(cron = "0/5 * * * * ?")
    public void publishKillCourse2Redis(){
        killCourseService.publishKillCourse2Redis();
    }
}
